package com.newer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.newer.domain.DeliveryOrder;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface DeliveryOrderMapper extends BaseMapper<DeliveryOrder> {
    @Select("select de.deliveryId,cl.clientOrderId,de.receivedPrice,de.collectionPrice,de.state, cl.clientId,cl.clientDate,cl.deliveryType,cl.clientSumPrice,cl.clientSumCount,cl.approver,cl.clientRemark,cl.clientState from t_delivery_order de inner join t_client_order cl on de.clientOrderId=cl.clientOrderId where deliveryId like CONCAT('%',#{deliveryId},'%')")
    @Results({
            @Result(column = "deliveryId",property = "deliveryid"),
            @Result(column = "clientOrderId",property = "clientorderid"),
            @Result(column = "receivedPrice",property = "receivedprice"),
            @Result(column = "collectionPrice",property = "collectionprice"),
            @Result(column = "state",property = "state"),
            @Result(column = "clientId",property = "clientOrder.clientid"),
            @Result(column = "clientDate",property = "clientOrder.clientdate"),
            @Result(column = "deliveryType",property = "clientOrder.deliverytype"),
            @Result(column = "clientSumPrice",property = "clientOrder.clientsumprice"),
            @Result(column = "clientSumCount",property = "clientOrder.clientsumcount"),
            @Result(column = "approver",property = "clientOrder.approver"),
            @Result(column = "clientRemark",property = "clientOrder.clientremark"),
            @Result(column = "clientState",property = "clientOrder.clientstate"),
    })
    Page<DeliveryOrder> selectMaterial(Page page, String deliveryId);
}